﻿using System;
using System.Collections.Generic;

namespace Tiens.NotificationHub.IntegrationEvents
{

    [Serializable]
    public class MailAddress: IEqualityComparer<MailAddress>
    {
        public MailAddress() { }

        public MailAddress(string name, string address)
        {
            this.Name = name;
            this.Address = address;
        }

        public string Name { get; set; }

        public string Address { get; set; }

        public override string ToString()
            => this.Address;

        public bool Equals(MailAddress x, MailAddress y)
            => x.Name == y.Name;

        public int GetHashCode(MailAddress obj)
            => obj.Name.GetHashCode();
    }
}
